import {
  Body,
  Controller,
  Get,
  Post,
  Query,
  Request,
  UseGuards,
} from '@nestjs/common';
import { BannerService } from './banner.service';
import { AuthGuard } from '@nestjs/passport';

@Controller('banner')
export class BannerController {
  constructor(private readonly bannerService: BannerService) {}

  @Get()
  // 查询轮播图列表
  getBannerList() {
    return this.bannerService.getBannerList();
  }

  @Post('add')
  // 添加轮播图
  @UseGuards(AuthGuard('jwt'))
  addBanner(@Body() bodyData) {
    return this.bannerService.addBanner(bodyData);
  }

  @Post('edit')
  // 添加轮播图
  @UseGuards(AuthGuard('jwt'))
  editBanner(@Body() bodyData) {
    return this.bannerService.editBanner(bodyData);
  }

  @Get('delete')
  //  删除轮播图
  @UseGuards(AuthGuard('jwt'))
  deleteBanner(@Query() params) {
    return this.bannerService.deleteBanner(params);
  }
}
